package com.service.impl;

import com.mapper.SysUserMapper;
import com.pojo.SysUser;
import com.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserServiceImpl implements SysUserService {
    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public SysUser login(String account, String password) {
        return sysUserMapper.login(account,password);
    }

    @Override
    public List<SysUser> list(String realName,Integer roleId,Integer page, Integer size) {
        int begin=(page-1)*size;
        return sysUserMapper.list(begin,size,realName,roleId);
    }

    @Override
    public int count(String realName,Integer roleId) {
        return sysUserMapper.count(realName,roleId);
    }

    @Override
    public SysUser selectId(Integer id) {
        return sysUserMapper.selectId(id);
    }

    @Override
    public int del(Integer id) {
        return sysUserMapper.del(id);
    }

    @Override
    public int selectAccount(String account) {
        return sysUserMapper.selectByAccount(account);
    }

    @Override
    public int add(SysUser sysUser) {
        return sysUserMapper.add(sysUser);
    }

    @Override
    public int edit(SysUser sysUser) {
        return sysUserMapper.edit(sysUser);
    }
}
